<?php $this->load->view('config/header_home');?>
<h2>Form <?php echo $mode?> user</h2>
<div class="line-separtor"></div>
<br/>	
	<a href="<?php echo site_url()?>user" class="btn btn-primary"> Kembali ke daftar </a>
<br/>
<br/>
<form method="post" action="<?php echo site_url() ?>user/<?php echo $action; ?>" class="form-horizontal">
	<input type="hidden" name="id_user" value="<?php echo @$detail[0]['id_user']?>">
	<input type="hidden" name="tgl_buat" value="<?php echo date('d-M-yyyy')?>">
	<div class="control-group">
		<label class="control-label" for="id_sektor">Kepolisian</label>
		<div class="controls">
			<select name="id_sektor">
				<option value="">--</option>
				<?php if (@$set_sektor):?>
					<?php foreach ($set_sektor as $row):?>
						<?php if ($row['id'] == @$detail[0]['id_sektor']):?>
							<?php $selected =  'selected="selected"' ?>
						<?php else :?>
							<?php $selected =  '' ?>
						<?php endif;?>
						<option value="<?php echo $row['id'] ?>" <?php echo $selected ?> ><?php echo $row['name'] ?></option>
					<?php endforeach?>
				<?php endif?>
			</select>
		</div>
	</div>
	
	<div class="control-group">
		<label class="control-label" for="nama_user">Nama pengguna</label>
		<div class="controls">
		  <input type="text" class="span5" name="nama_user" value="<?php echo @$detail[0]['nama_user']?>" >
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="password_user">Passwort pengguna</label>
		<div class="controls">
		  <input type="password" class="span5" name="password_user" value="<?php echo @$detail[0]['password_user']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="email_user">Email pengguna</label>
		<div class="controls">
		  <input type="text" class="span5" name="email_user" value="<?php echo @$detail[0]['email_user']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="telp_user">No. Telp pengguna</label>
		<div class="controls">
		  <input type="text" class="span5" name="telp_user" value="<?php echo @$detail[0]['telp_user']?>">
		</div>
	</div>
	<div class="control-group">
		<label class="control-label" for="alamat_user">Alamat pengguna</label>
		<div class="controls">
		  <input type="text" class="span5" name="alamat_user" value="<?php echo @$detail[0]['alamat_user']?>">
		</div>
	</div>
	
	<div class="control-group">
		<label class="control-label" for="akses_user">Akses pengguna</label>
		<div class="controls">
			<select name="akses_user">
				<?php $selected1 =  '' ?>
				<?php $selected2 =  '' ?>
				
				<?php if (@$detail[0]['akses_user'] == 1):?>
					<?php $selected1 =  'selected="selected"' ?>
				<?php elseif (@$detail[0]['akses_user'] == 2) :?>
					<?php $selected2 =  'selected="selected"' ?>
				<?php else:?>
					<?php $selected1 =  '' ?>
					<?php $selected2 =  '' ?>
				<?php endif;?>
			
				<option value="1" <?php echo $selected1 ?> >Administrator</option>
				<option value="2" <?php echo $selected2 ?> >Pengguna Umum</option>
			</select>
		</div>
	</div>
	
	<div class="control-group">
		<label class="control-label" for="enable">Enable</label>
		<div class="controls" style="padding-top:5px">
			<?php 
				if(@$detail[0]['enable'] == 1){
					$check = "checked";
				}else{
					if($action == "save"){
						$check = "checked";
					}else{
						$check = "";
					}
				}
			?>
			<input type="checkbox" name="enable" value="1" <?php echo $check; ?> ></input>
		</div>
	</div>
	
	<div class="form-actions">
	  <input type="submit" name="submit" value="Simpan" class="btn btn-primary" />
	  <a href="<?php echo site_url()?>user" class="btn">Batal</a>
	</div>
</form>
<?php $this->load->view('config/footer_home');?>